package com.un.ebs.core.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

@Getter
public enum DbTypeEnum implements IEnum {
    mysql(1, "MySql"), oracle(2, "Oracle"), sqlserver(3, "SqlServer"), dmsql(4, "DMSql");

    DbTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @EnumValue
    private final Integer value;
    private final String desc;

    @Override
    public int getCode() {
        return value;
    }

    public static DbTypeEnum valueOf(int code) {
        switch (code) {
            case 1:
                return DbTypeEnum.mysql;
            case 2:
                return DbTypeEnum.oracle;
            case 3:
                return DbTypeEnum.sqlserver;
            case 4:
                return DbTypeEnum.dmsql;
            default:
                return null;
        }
    }
}
